Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-react-svg

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-svg

Babel plugin to transform svg to react component

  • 2.2.0-nightly.58aa6b3c
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
132K
increased by23.25%
Maintainers
1
Weekly downloads
 
Created

What is babel-plugin-react-svg?

The babel-plugin-react-svg package is a Babel plugin that allows you to import SVG files as React components. This can be particularly useful for incorporating SVGs directly into your React components without having to manually convert them.

What are babel-plugin-react-svg's main functionalities?

Importing SVG as React Component

This feature allows you to import an SVG file and use it as a React component. The SVG file is transformed into a React component, which can then be used like any other React component.

import MyIcon from './icon.svg';

const App = () => (
  <div>
    <MyIcon />
  </div>
);

Customizing SVG with Props

You can pass props to the imported SVG component to customize its attributes such as width, height, and fill color. This makes it easy to reuse the same SVG with different styles.

import MyIcon from './icon.svg';

const App = () => (
  <div>
    <MyIcon width="50" height="50" fill="red" />
  </div>
);

Other packages similar to babel-plugin-react-svg

Keywords

FAQs

Package last updated on 27 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc